# Contributor: Michael Mason <ms13sp@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=screen
pkgver=4.8.0
pkgrel=1
pkgdesc="Window manager that multiplexes a physical terminal"
url="https://www.gnu.org/software/screen/"
arch="all"
license="GPL-3.0-or-later"
options="!check"  # No test suite.
makedepends="ncurses-dev ncurses"
subpackages="$pkgname-doc"
source="https://ftp.gnu.org/gnu/screen/screen-$pkgver.tar.gz"

# secfixes:
#   4.8.0-r0:
#     - CVE-2020-9366

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--with-sys-screenrc=/etc/screenrc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--enable-colors256 \
		--enable-telnet \
		--enable-rxvt_osc
	make
}

package() {
	make -j1 DESTDIR="$pkgdir" install

	# remove suid root
	find "$pkgdir" -type f -perm -u+s -print0 \
		| xargs -0 chmod -s

	install -Dm644 etc/etcscreenrc "$pkgdir"/etc/screenrc
	install -Dm644 etc/screenrc "$pkgdir"/etc/skel/.screenrc
}

sha512sums="770ebaf6ee9be711bcb8a6104b3294f2bf4523dae6683fdc5eac4b3aff7e511be2d922b6b2ad28ec241113c2e4fe0d80f9a482ae1658adc19c8c3a3680caa25c  screen-4.8.0.tar.gz"
